$("#loginBtn").click(function() {
	var $user = $("#user").val();
	var $pwd = $("#password").val();
	if($user == '' || $pwd == '') {
		failure('请将内容填写完成！');
		return
	} 
	var data0 = {
		user_name:$user,
		user_pwd:$pwd
	}

    $.ajax({
        url: geturl('LOGIN_CGI.cgi'),
        type: 'POST',
        beforeSend: function(xhr) {
            // xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
            xhr.setRequestHeader("Content-Type", "application/json")
        },
        data: JSON.stringify(data0),
        success: function(res) {
            if (res.success == "true") {
                window.localStorage.setItem('user_token', res.data.token);
                window.localStorage.setItem('user_name', res.data.user_name);
                window.localStorage.setItem('time_stamp', res.data.time_stamp);
                window.location.href = window.history.go(-1);
            } else {
                failure(res.data.msg);
            }
        },
        error: function(XHR) {
            error(XHR);
        }
    });
});